home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / TCP_IP / TNOS230S / MAKEFILE.DOS < prev    next >
Encoding:
Text File  |  1997-09-14  |  10.4 KB  |  418 lines

  1. #
  2. # Makefile for Tampa Network Operating System (TNOS)
  3. #
  4.  
  5. ##############################################################################
  6. #                                                                            #
  7. # The values in this Makefile SHOULD NOT need to be altered, and temptation  #
  8. # to do so should be resisted. Doing so will make it easier to have major    #
  9. # problems down the road as you upgrade to later versions.                   #
  10. #                                                                            #
  11. # Instead, all local customizations should be placed in a separate file,     #
  12. # named 'make.inc'. This file (if it exists) is included in the processing   #
  13. # of this Makefile, and anything in that file can override settings in       #
  14. # this file.                                                                 #
  15. #                                                                            #
  16. # Just say NO to editing the Makefile! If the author can resist the          #
  17. # temptation, so can you ;-)                                                 #
  18. #                                                                            #
  19. # There ARE notes throughout this Makefile as to things that you MAY wish    #
  20. # to override in 'make.inc', so you are encouraged to look through here, and #
  21. # build your own 'make.inc' as needed.                                       #
  22. #                                                                            #
  23. ##############################################################################
  24.  
  25.  
  26. #######################
  27. #                     #
  28. #  Version Variables  #
  29. #                     #
  30. # DO NOT change these #
  31. #                     #
  32. #######################
  33.  
  34. VERSION = 2
  35. RELEASE = 3
  36. LEVEL = 0
  37.  
  38. # This defines whether this is a beta-test version or not. Make it blank
  39. # for release level compiles
  40. BETA = #-DBETA
  41.  
  42. ifdef BETA
  43. # This is either 'a' for alpha, 'b' for beta, 'pl' for a interim patch
  44. # level, or ignored for release level compiles
  45. SUBTYPE = b
  46.  
  47. # This will be ignored for release level compiles
  48. SUBLEVEL = 4
  49. endif
  50.  
  51. VSTR = $(VERSION).$(RELEASE)$(LEVEL)$(SUBTYPE)$(SUBLEVEL)
  52. VERS = $(BETA) -DVERSION=\"$(VSTR)\"
  53.  
  54. ifeq ($(strip $(BETA)),)
  55. VERS := $(VERS) -DNDEBUG
  56. endif
  57.  
  58.  
  59. #######################
  60. #                     #
  61. # Commands/Parameters #
  62. #                     #
  63. #######################
  64.  
  65. #
  66. # Executable command names
  67. #
  68. # These are processed BEFORE the inclusion of any 'make.inc' files, to allow
  69. # you to easily override them to your needs.
  70. #
  71. CC        = gcc
  72. RM        = redir -e nul command /c del
  73. DEP        = redir -e nul command /c 
  74. AR        = ar rcs
  75. MKDIR        = mkdir
  76. COPY        = copy
  77. TOUCH        = touch
  78. STRIP        = strip
  79. COFF2EXE    = coff2exe
  80. RANLIB        = ranlib
  81. MKVERS        = mkvers
  82. PMODESTUB    = true
  83. TCL        = tclsh
  84. CONFIG_TARGETS    = mkconfig.tcl config.in
  85. CATALOG_TARGETS    = catalog.dat buildcat
  86. CATALOGPADDING  = 0
  87.  
  88.  
  89. #######################
  90. #                     #
  91. #  Supported Patches  #
  92. #                     #
  93. #######################
  94.  
  95. #
  96. # Supported patches are:
  97. #
  98. # -DIS_LITTLE_ENDIAN    Intel byte ordering, vs. Motorola
  99. #
  100. PATCHES = -DIS_LITTLE_ENDIAN -DHAVE_TM_ISDST
  101.  
  102.  
  103.  
  104. #######################
  105. #                     #
  106. # Warnings -- friends #
  107. #                     #
  108. #######################
  109.  
  110. #
  111. # Warnings --- disable for less noise, enable for more certainty :-)  gcc will
  112. # whine about things like partly bracketed initializers if you specify -W, but
  113. # this can be ignored unless you're trying to port JNOS to VMS....
  114. #
  115. # TNOS/Linux is much cleaner in this area, but there are some portability
  116. # warnings still (-Wtraditional) and some non-globally-prototyped functions.
  117. #
  118. WARNINGS = $(OPTIONAL)
  119.  
  120.  
  121. #
  122. # If you are using a non-GCC compiler, or a GCC compiler prior to 2.7.0, you
  123. # will want to override this next line in 'make.inc'. You will probably get
  124. # several warnings about unused parameters to functions, but those are to be
  125. # expected. If you are using GCC 2.7.0 or later, this line is fine.
  126. #
  127. OPTIONAL = -DOPTIONAL=
  128.  
  129.  
  130. #######################
  131. #                     #
  132. #     OPTIMIZATION    #
  133. #                     #
  134. #######################
  135.  
  136. #
  137. # This should normally be fine, but if you encounter unusual errors compiling,
  138. # and the code LOOKS good, try redefining this in 'make.inc' as 'OPTIMIZE='
  139. #
  140. OPTIMIZE = -O2 -Wuninitialized 
  141.  
  142.  
  143.  
  144. #######################
  145. #                     #
  146. # Debugging Variables #
  147. #                     #
  148. #######################
  149.  
  150. #
  151. # The following definition can be used to compile in code to help profile
  152. # the performance of TNOS. I do NOT suggest it's use in real-world situations,
  153. # as it adds to the size of the executable, uses more memory, and slows down
  154. # the execution of the program. If you DO wish to use it, though, then
  155. # override it in 'make.inc' as 'PROFILE = -pg'
  156. #
  157. PROFILE =
  158.  
  159.  
  160. #
  161. # I strongly advise leaving the debugging information in, because this is NOT
  162. # production-quality code.  -g1 instead of -g3 will make nos smaller, however,
  163. # and leaving off -g entirely will make it a LOT smaller.
  164. #
  165. # I *DO*, though, remove the debugging info from official distribution
  166. # executables, in the interest of keeping download sizes smaller.
  167. #
  168. # The DBGLIB could be overriden in 'make.inc' to 'DBGLIB=-lefence' to compile
  169. # using the publicly available memory debugging tool 'Electric Fence', or
  170. # for other debugging libraries. 'Electric Fence' is not required for TNOS.
  171. #
  172. DEBUG =  $(PROFILE) -g3
  173. DBGLIB =
  174.  
  175.  
  176. #
  177. # This is for use in testing.  Don't worry about it unless you want to be
  178. # able to build custom versions.
  179. #
  180. NOS = tnos
  181.  
  182.  
  183.  
  184. ###############
  185. #             #
  186. # Directories #
  187. #             #
  188. ###############
  189.  
  190. #
  191. # This defines the root directory that you want TNOS installed into. You
  192. # *WILL* want to override this in 'make.inc', if you wish to install TNOS
  193. # anywhere else but '/nos'. The NOSDIRCMD *MUST* be the same thing, but with
  194. # backslashes. NOSDIRCMD is used for commands passed to COMMAND.COM.
  195. # NOSDIR *MUST* be forward slashes. Thanks, DOS!
  196. #
  197. # To make this easier to customize (and harder to goof up), use the ROOTDRIVE
  198. # and ROOTDIR variables, instead, to change the path.
  199. #
  200. ROOTDRIVE=c
  201. ROOTDIR=nos
  202. NOSDIR=$(ROOTDRIVE):/$(ROOTDIR)
  203. NOSDIRCMD=$(ROOTDRIVE):\$(ROOTDIR)
  204.  
  205.  
  206.  
  207. #############################
  208. #                           #
  209. # User and System Overrides #
  210. #                           #
  211. #############################
  212.  
  213.  
  214. #
  215. # Include any files overridding any of these variables, if they exist
  216. #
  217. ifeq (make.inc,$(wildcard make.inc))
  218. include make.inc
  219. endif
  220.  
  221.  
  222.  
  223. ####################################################
  224. #                                                  #
  225. # No user overridable variables beyond this point! #
  226. #                                                  #
  227. ####################################################
  228.  
  229.  
  230. KBRAW = kbraw.o
  231. CDEPFLAGS = -DMSDOS
  232.  
  233.  
  234.  
  235. ############################
  236. #                          #
  237. # The primary targets used #
  238. #                          #
  239. ############################
  240.  
  241.  
  242. include makefile.all
  243.  
  244. $(NOS): catalog.h $(REQUIRED) $(LIBS)
  245.     echo --- Indexing All Archives
  246.     $(RANLIB) $(LIBS)
  247.     echo --- Linking: $(NOS)
  248.     $(CC) $(CFLAGS) -o $(NOS) $(REQUIRED) $(LIBS) $(LCURSES) $(DBGLIB) $(LSQL) -lpc
  249.     -$(MKVERS) $(NOSDIR)
  250.  
  251.  
  252. $(NOS).exe: $(NOS)
  253.     echo --- Striping symbols from $(NOS).exe
  254.     $(STRIP) $(NOS)
  255.     $(COFF2EXE) $(NOS)
  256.  
  257.  
  258.  
  259. ##############################################
  260. #                                            #
  261. # Definition for making certain header files #
  262. #                                            #
  263. ##############################################
  264.  
  265.  
  266. hardware.h: nospc.h
  267.     $(COPY) nospc.h hardware.h
  268.  
  269. config.h: $(CONFIG_TARGETS)
  270.     echo $(NOSDIR) >nosdir
  271.     $(TCL)
  272.     -$(RM) nosdir
  273.  
  274. catalog.h: $(CATALOG_TARGETS)
  275.     buildcat $(CATALOGPADDING)
  276.  
  277. make.inc:
  278.     echo "No make.inc file found"
  279.  
  280.  
  281.  
  282. ##########################
  283. #                        #
  284. # Administrative targets #
  285. #                        #
  286. ##########################
  287.  
  288.  
  289. zapVersion:
  290.     echo --- Removing Version-specific object files
  291.     -$(RM) mkvers.exe
  292.     -$(RM) mkvers
  293.     -$(RM) version.o
  294.     -$(RM) mailbox.o
  295.     -$(RM) catalog.o
  296.     -$(RM) register.o
  297.  
  298. clean:
  299.     -$(RM) *.o
  300.     -$(RM) *.a
  301.     -$(RM) buildcat.exe
  302.     -$(RM) buildctl.exe
  303.     -$(RM) checkcat.exe
  304.     -$(RM) ctlcheck.exe
  305.     -$(RM) deldep.exe
  306.     -$(RM) cnvfwd.exe
  307.     -$(RM) mkvers.exe
  308.     -$(RM) buildcat
  309.     -$(RM) buildctl
  310.     -$(RM) checkcat
  311.     -$(RM) ctlcheck
  312.     -$(RM) deldep
  313.     -$(RM) cnvfwd
  314.     -$(RM) mkvers
  315.  
  316. realclean: clean
  317.     -$(RM) config.h
  318.     -$(RM) hardware.h
  319.     -$(RM) depend
  320.     -$(RM) $(NOS)
  321.     -$(RM) $(NOS).exe
  322.     echo "" >depend
  323.  
  324.  
  325. depend dep: hardware.h config.h catalog.h
  326.     echo --- Determining Dependencies
  327.     $(DEP) $(CC) -MM $(CDEPFLAGS) $(PATCHES) *.c >depend
  328.  
  329. initial:
  330.     $(MKDIR) $(NOSDIRCMD)
  331.     $(MKDIR) $(NOSDIRCMD)\spool
  332.     $(MKDIR) $(NOSDIRCMD)\public
  333.     $(MKDIR) $(NOSDIRCMD)\finger
  334.     $(MKDIR) $(NOSDIRCMD)\etc
  335.     $(MKDIR) $(NOSDIRCMD)\spool\mail
  336.     $(MKDIR) $(NOSDIRCMD)\spool\mail\control
  337.     $(MKDIR) $(NOSDIRCMD)\spool\mail\users
  338.     $(MKDIR) $(NOSDIRCMD)\spool\mqueue
  339.     $(MKDIR) $(NOSDIRCMD)\etc\help
  340.     $(MKDIR) $(NOSDIRCMD)\spool\info
  341.     $(MKDIR) $(NOSDIRCMD)\spool\news
  342.     $(MKDIR) $(NOSDIRCMD)\spool\signatur
  343.     $(MKDIR) $(NOSDIRCMD)\spool\cmds
  344.     
  345. install:
  346.     $(COPY) $(NOS).exe $(NOSDIRCMD)
  347.     $(COPY) ctlcheck.exe $(NOSDIRCMD)
  348.     $(COPY) buildctl.exe $(NOSDIRCMD)
  349.  
  350. touch:
  351.     -$(TOUCH) config.h catalog.h
  352.     -$(TOUCH) *.o
  353.     -$(TOUCH) *.a
  354.     -$(TOUCH) ctlcheck.exe buildctl.exe deldep.exe mkvers.exe
  355.     -$(TOUCH) ctlcheck buildctl deldep mkvers
  356.  
  357.  
  358. applypatch:
  359.     -patch -p1 -s -l <patchkit.*
  360.     -$(RM) patchkit.*
  361.  
  362. cleanpatch:
  363.     -$(RM) *.c~ *.h~
  364.  
  365.  
  366.  
  367. #######################################
  368. #                                     #
  369. # Special cases for certain *.c files #
  370. #                                     #
  371. #######################################
  372.  
  373.  
  374. kbraw.o: kbraw.s
  375.  
  376.  
  377.  
  378.  
  379. ##################
  380. #                #
  381. # Explicit rules #
  382. #                #
  383. ##################
  384.  
  385.  
  386. .c.o:
  387.     echo --- Compiling: $<
  388.     $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
  389.  
  390. .s.o:
  391.     echo --- Assembling: $<
  392.     $(CC) -c -o $@ $<
  393.  
  394.  
  395. #
  396. # and include a dependency file if one exists, which it SHOULD
  397. #
  398. ifeq (depend,$(wildcard depend))
  399. include depend
  400. endif
  401.  
  402.  
  403. .SILENT:
  404.  
  405.  
  406. .PHONY: $(NOS).exe
  407.  
  408.  
  409. #
  410. # finally, allow the user to define additional targets.
  411. # this is done at the end, rather than in make.inc, to avoid
  412. # having the default target of 'all' changed.
  413. #
  414. ifeq (make.end,$(wildcard make.end))
  415. include make.end
  416. endif
  417.  
  418.